// Copyright (c) 2025, 大连理工大学 (Dalian University of Technology)
//
// Licensed under the Mulan PSL v2.
// You can use this file according to the terms and conditions of the Mulan PSL v2.
// You may obtain a copy of the License at
//
//     http://license.coscl.org.cn/MulanPSL2
//
// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
// EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. SEE THE MULAN PSL v2
// FOR MORE DETAILS.

/*
 * @Author: qiulin_JXGM ql1746365080@gmail.com
 * @Date: 2024-10-10 10:15:22
 * @LastEditors: qiulin 1746365080@qq.com
 * @LastEditTime: 2025-01-08 19:47:07
 * @FilePath: \SGFEM\Import\BDFImport\ControlData\ExecutiveControlParser.cpp
 */

#include "ExecutiveControlParser.h"

#include "Utility/Logging/SGLogger.h"

CONTROLDATA_ENTRY_PARSER_REG (SOL)

using namespace SG::Import::BDF;
using namespace SG::DataStructure;
Common::Status SG::Import::BDF::CONTROLDATA::ParseSOL (FEM::Subcase::ControlInfo& controlInfo, SG::Utility::SGParameter& _OUT subcase)
{
    SG::Import::BDF::CaseDataEntryParserFactory* factory = SG::Import::BDF::CaseDataEntryParserFactory::GetInstance ();

    factory->m_SolutionSequences = convertToI64 (controlInfo.m_Vaule);

    SG::Utility::SGParameter ParameterAnalysis;

    bool isOverwrite = true;

    switch (factory->m_SolutionSequences)
    {
    case 153:
    case 108:
    case 109:
    case 112:
        ParameterAnalysis.AddString (SG::DataStructure::FEM::Subcase::SC_MAINKEY, std::to_string (factory->m_SolutionSequences));
        break;
    default:
        isOverwrite = false;
        break;
    }
    if (isOverwrite)
    {
        subcase.AddValue ("SOL", ParameterAnalysis);
    }

    return Common::Status::STATUS_Success;
}